package utils;

/**
 * 时间计数器
 * @author yaohuaiying
 * @create 2018-02-07 10:11
 **/
public class timeCount {

    public static void timeMillis(Callback callBack){
        long start = System.currentTimeMillis();
        callBack.excute();
        long end = System.currentTimeMillis();
        System.out.println(callBack.getClass().getName() + " 执行了：" + (end - start)+"毫秒");
    }

    public static void timeNano(Callback callBack){
        long start = System.nanoTime();
        callBack.excute();
        long end = System.nanoTime();
        System.out.println(callBack.getClass().getName() + " 执行了：" + (end - start)+"纳秒");
    }
}
